﻿#pragma once
#include "QDialog"
#include "ui_systemSetDlg.h"
#include "common.h"
#include "QComboBox"
#include "ui_devNamSet.h"
#include "QLineEdit"
#include "QCheckBox"
#include "QFormLayout"
#include "QGroupBox"
#include "ui_commSetWidget.h"
#include <tuple>


class EagleMainFrame;

// page 页面设置  接口定义  在响应 
class setPageWidget
	:public QWidget
{

	Q_OBJECT

public:

	setPageWidget(QWidget *parent = 0)
		:QWidget(parent)
	{

	}

	virtual int on_setOK() = 0;
};

// systemSet
class communicateWidget
	:public setPageWidget
{

Q_OBJECT

public:
	communicateWidget(QWidget *parent = 0);
	

	~communicateWidget()
	{

	}

	virtual int on_setOK();

protected:

	void freshList();

private:
	Ui::netSet ui;
	QStringList _comStrList;
	QStringList _netStrList;
	int  _default_selection;
};

// 单个磁盘设置 [11/3/2016 ejitec]
class diskMapWidget
	:public QWidget
{

	Q_OBJECT

public:
	diskMapWidget(TDevWithCCDInfo* devInfo, QWidget *parent = 0);
	~diskMapWidget();

	int on_setOK();

protected:


private:
	QVector<QButtonGroup*> _vButtons;
	TDevWithCCDInfo* _tdevInfo;
};

// 所有磁盘设置
class disksMapWidget
	:public setPageWidget
{

	Q_OBJECT

public:
	disksMapWidget(QVector<TDevWithCCDInfo*>& devs, QWidget *parent = 0);
	
	~disksMapWidget()
	{
	}
	
	int on_setOK();
	
private:
	QVector<diskMapWidget*> _vDisksMap;
	QVector<TDevWithCCDInfo*>&  _tDevsInfo;
};

// 磁盘阈值设置 [11/4/2016 ejitec]
class devsTaskSet
	:public setPageWidget
{
	Q_OBJECT

public:
	devsTaskSet(QVector<TDevWithCCDInfo*>& devs,QString strTask, QWidget *parent = 0);
	QMap<QString, QComboBox*> m_diskYZ;
	QMap<QString, QHBoxLayout*> m_DevAddr;

	int on_setOK();
	void setTaskNam(QString nam)
	{
		m_strTaskNam = nam;
	}

signals:

	void evt_taskNam(const QString& strNam);

protected:
private:
	QVector<TDevWithCCDInfo*>&  _tDevsInfo;
	QString m_strTaskNam;

};

// 相机名称设置,使用部分静态UI [11/4/2016 ejitec]
class ADevNamsSet
	:public setPageWidget
{
	Q_OBJECT
		
public:

	ADevNamsSet(TDevWithCCDInfo* dev, QWidget *parent = 0);

	int on_setOK();
private:
	QLineEdit* _lineEditDev;
	TDevWithCCDInfo* _tdevInfo;
	QVector<QWidget*> _vNameList;
	QFormLayout* _formLayOut;
};


class AllDevNamSet
	:public setPageWidget
{
	Q_OBJECT
	
public:
	AllDevNamSet(QVector<TDevWithCCDInfo*>& devs, QWidget *parent = 0);

	int on_setOK();

protected:

private:
	QVector<TDevWithCCDInfo*>&  _tDevsInfo;
	QVector<ADevNamsSet*> _vDevSets;
	Ui::devNamSet ui;
};


// 采集参数设置 [11/7/2016 ejitec]

class AllCLCCDParmConfig
	:public setPageWidget
{
	Q_OBJECT
		
	typedef std::function<void(CameraModeType &cl_mode, long &column, long &line, long &bits, 
	long &rate, long &taps, unsigned long &shrink_level,bool& bEnable)> pfCLGetConfig;

	typedef std::tuple<int, TCCDInfo*, pfCLGetConfig> multiyType;
		
public:
	AllCLCCDParmConfig(QWidget *parent = 0);
	void InsertOneCCD(TDevWithCCDInfo& dev);
	int on_setOK();

signals:


private:

	QVBoxLayout* _vLayout;
	QGridLayout* _paramGridL;
	QGroupBox* _group;
	std::vector<multiyType> m_tpList;
};

class AllSDICCDParmConfig
	:public setPageWidget
{
	Q_OBJECT

	typedef std::function<void(int&sdi_mode, long &column, long &line, long &bits, bool& bEnable)> pfSdiGetConfig;
	typedef std::tuple<int, TCCDInfo*, pfSdiGetConfig> multiyType;
public:
	AllSDICCDParmConfig(QWidget *parent = 0);
	void InsertOneCCD(TDevWithCCDInfo& dev);
	int on_setOK();

private:
	QVBoxLayout* _vLayout;
	QGridLayout* _paramGridL;
	QGroupBox* _group;
	std::vector<multiyType> m_tpList;
};



class camGrabParamSet
	:public setPageWidget
{
	Q_OBJECT

	
public:

	camGrabParamSet(QVector<TDevWithCCDInfo*>& devs, QWidget *parent = 0);
	~camGrabParamSet(){}

	int on_setOK();

signals:

protected:

private:
	QVector<TDevWithCCDInfo*>& _tDevsInfo;
	AllCLCCDParmConfig* _pCLs;
	AllSDICCDParmConfig* _pSdis;
	QVBoxLayout* _vLPanel;
	
};



//////////////////////////////////////////////////////////////////////////
// tab设置 总对话框 [11/7/2016 ejitec]
class systemSetDlg
	:public QDialog
{

public:

	Q_OBJECT

public:
	systemSetDlg(QWidget *parent = 0);
	~systemSetDlg();

protected:

protected slots:

	void on_setDlgOK();

private:

	Ui::systemSetDlg ui;
	// page 页的对象名称 与 设置页面
	QMap<QString, setPageWidget*> _mPageList;
};

